import React, {Component} from 'react';
import {Image, StyleSheet, View} from 'react-native';
import utils from './../utils/utils';

export default class StyleManProfileDemo extends Component {

    constructor(props) {
        super(props);
    }

    makePic() {
        let myImage = [];
        if (this.props.datas != null) {
            let picLength = this.props.datas.length;
            let datas = this.props.datas;

            for (let n = 0; n < picLength; n++) {
                myImage.push(
                    <View key={n}
                          style={[styles.imgViewItem, n % 2 == 0 ? {paddingRight: utils.autoWidth(1)} : null]}><Image
                        style={styles.imgDemo}
                        source={{uri: utils.qiniuUrl + datas[n] + utils.qiniu500Url}}></Image></View>
                );
            }
        }
        return (
            <View style={styles.imgStyle}>
                {myImage}
            </View>


        )

    }

    render() {

        return (
            <View style={styles.pageView}>
                {this.makePic()}
            </View>
        );
    }
};
const styles = StyleSheet.create({
    pageView: {
        flex: 1,
        flexDirection: 'row',
    },
    imgViewItem: {
        width: utils.screenWidth / 2,
        height: utils.autoheight(200),
        paddingBottom: utils.autoheight(1),
    },
    imgDemo: {
        flex: 1,
    },
    imgStyle: {
        width: utils.screenWidth,
        flexDirection: 'row',
        flexWrap: 'wrap',
        alignItems: 'center', // 必须设置,否则换行不起作用
    }
})